<template>
    <div>
        <div>新增菜单信息</div>
        <div>
            <div class="shuchu1">
      菜单名称:
      <el-input
        v-model="menu_name"
        placeholder="请输入内容"
        style="width: 230px"
      ></el-input>
    </div>
    <div class="shuchu1">
      菜单路由:
      <el-input
        v-model="address"
        placeholder="请输入内容"
        style="width: 230px"
      ></el-input>
    </div>
    <div class="shuchu1">
      关联子级路由id:
      <el-input
        v-model="parent"
        placeholder="请输入内容"
        style="width: 230px"
      ></el-input>
    </div>
    
 
    
    <div class="but1">
      <el-button type="success" @click="createmenu">确定</el-button>
      <el-button @click="fanhui" type="info">返回</el-button>
    </div>
        </div>
        </div>
    
</template>

<script>
export default {
    name: 'createmenu',
    data() {
        return {
            parent:'',
            menu_name:'',
            address:'',
        };
    },
    props: {},

    components: {},

    created() {},

    mounted() {},

    methods: {
        createmenu(){
            this.axios.post('http://127.0.0.1:8000/rbac/v1/createmenu/',{
                address:this.address,
                menu_name:this.menu_name,
                parent:this.parent,
            }).then(res=>{
                if (res.data.code == 200) {
                    alert('添加成功')
                }
            }).catch(err=>{
                console.log(err);
                alert('添加失败')
            })
        },
        fanhui(){
            this.$router.push('/mainhome')
        }
    },

    computed: {},

    watch: {},

    directives: {},

    filters: {}
};
</script>

<style scoped >

</style>
